package es.ibm.santillana.mdm.xml;

import java.util.ArrayList;
import java.util.HashMap;

import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Element;

import com.ibm.pim.context.Context;

import es.ibm.santillana.mdm.common.util.ConstSantillana;
import es.ibm.santillana.mdm.integration.Modification;

public class DeleteXML extends XMLIntegration{

	public DeleteXML(Context ctx, String catalogName, String sPk) throws ParserConfigurationException {
		super(ctx,sPk, catalogName);
	}
	
	@Override
	public String getExportXML(HashMap<String,ArrayList<Modification>> hmDeletetAttss) {
		Element elementMensajeRoot = getDeleteXML();
		
		Element head = createHead();
		elementMensajeRoot.appendChild(head);
		Element body = null;
		if(getCatalogName().equals(ConstSantillana.MAESTRO_ARTICULOS)){
			//REcorrer elementos del body:
			body = createBodyDelete(hmDeletetAttss,"delete");
		}else{
			body = createTableBodyDelete(hmDeletetAttss.get(ConstSantillana.XMLTags.Body.tablasReferencia),getCatalogName());
			
			
		}
		
		elementMensajeRoot.appendChild(body);
		
		
		
		
//		System.out.println(getStringFromDoc(getDoc()));
		return getStringFromDoc(getDoc());
	}




	public Element getDeleteXML(){
		return createRootElement("delete");
	}

}
